package networkTCPIP;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class server {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(10005);
        Socket accept = serverSocket.accept();
        //接受用户的请求信息
        InputStream inputStream = accept.getInputStream();
        byte[] bytes = new byte[1024];
        int len = inputStream.read(bytes);
        //解析信息
        String s = new String(bytes, 0, len);
        System.out.println("s = " + s);
        //给用户反馈
        OutputStream outputStream = accept.getOutputStream();
        outputStream.write("数据已经收到".getBytes());
        serverSocket.close();
    }
}
